/**
 *
 * @param codeLength
 * @returns
 * @description 生成codeLength长度的code
 */
export default function randomCode(codeLength: number) {
  let code = Math.floor(
    Math.random() * (Math.pow(10, codeLength) - 1),
  ).toString();

  code =
    code.length === codeLength
      ? code
      : new Array(codeLength - code.length).fill(0).join('') + code;

  return code;
}
